//
//  AppDelegateManager.m
//  高仿暴走斗图
//
//  Created by huangsongyao on 16/3/4.
//  Copyright © 2016年 huangsongyao. All rights reserved.
//

#import "AppDelegateManager.h"
#import "FMDBOperationManager.h"
#import "NetWorkingManager+Config.h"

static AppDelegateManager *appDelegateManager;

@implementation AppDelegateManager

+ (instancetype)shareInstance {

    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        appDelegateManager = [[AppDelegateManager alloc] init];
    });
    return appDelegateManager;
}

- (instancetype)init {
    
    if (self = [super init]) {
        NSLog(@"AppDelegateManager");
    }
    
    return self;
}


- (RACSignal *)rac_application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    return [RACSignal createSignal:^RACDisposable *(id<RACSubscriber> subscriber) {
        
        [[[UserManager initWithLocalConfiguration] deliverOn:[RACScheduler mainThreadScheduler]] subscribeNext:^(id x) {
            
            [FMDBOperationManager shareInstance];
            [subscriber sendNext:x];
            [subscriber sendCompleted];
//            [[[NetWorkingManager shareInstance] getAPPConfigWithUserId:[[UserManager shareInstance] getUserID]] subscribeNext:^(RACTuple *tuple) {
//                
//                [subscriber sendNext:tuple];
//                [subscriber sendCompleted];
//
//            } error:^(NSError *error) {
//                
//                [subscriber sendError:error];
//                
//            }];
        }];
        
        return nil;
    }];
}

- (void)addShareSDK {
    
}

@end
